package the.workshop.bu.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wisteria.framework.web.APIResult;
import org.wisteria.framework.web.QueryResult;
import the.workshop.bu.dto.CheckDataDTO;
import the.workshop.bu.dto.MobileCheckDTO;
import the.workshop.bu.dto.req.MobileCheckConditionReq;
import the.workshop.bu.dto.req.MobileCheckExecuteReq;
import the.workshop.bu.service.IMobileCheckService;

import javax.annotation.Resource;

@RestController
@RequestMapping("/bu/check")
public class CheckController {

    @Resource
    private IMobileCheckService mobileCheckService;

    /**
     * 执行手机号码检测
     * @param req
     * @return
     */
    @GetMapping("/executeMobileCheck")
    public APIResult<CheckDataDTO> executeMobileCheck(@ModelAttribute MobileCheckExecuteReq req) {
        return APIResult.success(mobileCheckService.executeMobileCheck(req));
    }

    /**
     * 查询手机号码检测信息
     * @return
     */
    @GetMapping("/queryMobileCheck")
    public APIResult<QueryResult<MobileCheckDTO>> queryMobileCheck(@ModelAttribute MobileCheckConditionReq req) {
        return APIResult.success(mobileCheckService.pageList(req));
    }

}
